﻿# 顶层 CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project("3DPCL" LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(MSVC)
    add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
endif()

# ==================== Qt 配置 ====================
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)

set(Qt5_DIR "F:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5")
find_package(Qt5 COMPONENTS Widgets REQUIRED)
if(NOT Qt5_FOUND)
    message(FATAL_ERROR "Qt5 Widgets not found!")
endif()

# ==================== PCL 配置 ====================
set(PCL_ROOT "F:/PCL/PCL 1.12.0")
find_package(PCL 1.12 REQUIRED COMPONENTS common io visualization filters)
if(NOT PCL_FOUND)
    message(FATAL_ERROR "PCL 1.12 not found! 请检查PCL_ROOT是否正确")
endif()
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

# ==================== OpenCV 配置 ====================
set(OpenCV_DIR "F:/OpenCV4.4")
find_package(OpenCV REQUIRED)
if(NOT OpenCV_FOUND)
    message(FATAL_ERROR "OpenCV not found! 检查OpenCV_DIR: ${OpenCV_DIR}")
endif()
include_directories(${OpenCV_INCLUDE_DIRS})
link_directories(${OpenCV_LIB_DIR})

# ==================== VTK 全局路径配置（仅定义路径，不链接目标） ====================
set(VTK_INCLUDE_DIR "F:/VTK/vtk-install/debug/include/vtk-9.0")
if(NOT EXISTS ${VTK_INCLUDE_DIR})
    message(FATAL_ERROR "VTK Debug 头文件目录不存在：${VTK_INCLUDE_DIR}")
endif()
include_directories(${VTK_INCLUDE_DIR})

set(VTK_LIB_DIR "F:/VTK/vtk-install/debug/lib")
if(NOT EXISTS ${VTK_LIB_DIR})
    message(FATAL_ERROR "VTK Debug 库文件目录不存在：${VTK_LIB_DIR}")
endif()
link_directories(${VTK_LIB_DIR})

set(VTK_LIBS
    vtkChartsCore-9.0d.lib
    vtkCommonColor-9.0d.lib
    vtkCommonComputationalGeometry-9.0d.lib
    vtkCommonCore-9.0d.lib
    vtkCommonDataModel-9.0d.lib
    vtkCommonExecutionModel-9.0d.lib
    vtkCommonMath-9.0d.lib
    vtkCommonMisc-9.0d.lib
    vtkCommonSystem-9.0d.lib
    vtkCommonTransforms-9.0d.lib
    vtkDICOMParser-9.0d.lib
    vtkDomainsChemistry-9.0d.lib
    vtkdoubleconversion-9.0d.lib
    vtkexodusII-9.0d.lib
    vtkexpat-9.0d.lib
    vtkFiltersAMR-9.0d.lib
    vtkFiltersCore-9.0d.lib
    vtkFiltersExtraction-9.0d.lib
    vtkFiltersFlowPaths-9.0d.lib
    vtkFiltersGeneral-9.0d.lib
    vtkFiltersGeneric-9.0d.lib
    vtkFiltersGeometry-9.0d.lib
    vtkFiltersHybrid-9.0d.lib
    vtkFiltersHyperTree-9.0d.lib
    vtkFiltersImaging-9.0d.lib
    vtkFiltersModeling-9.0d.lib
    vtkFiltersParallel-9.0d.lib
    vtkFiltersParallelImaging-9.0d.lib
    vtkFiltersPoints-9.0d.lib
    vtkFiltersProgrammable-9.0d.lib
    vtkFiltersSelection-9.0d.lib
    vtkFiltersSMP-9.0d.lib
    vtkFiltersSources-9.0d.lib
    vtkFiltersStatistics-9.0d.lib
    vtkFiltersTexture-9.0d.lib
    vtkFiltersTopology-9.0d.lib
    vtkFiltersVerdict-9.0d.lib
    vtkfreetype-9.0d.lib
    vtkGeovisCore-9.0d.lib
    vtkgl2ps-9.0d.lib
    vtkglew-9.0d.lib
    vtkGUISupportQt-9.0d.lib
    vtkGUISupportQtSQL-9.0d.lib
    vtkhdf5-9.0d.lib
    vtkhdf5_hl-9.0d.lib
    vtkImagingColor-9.0d.lib
    vtkImagingCore-9.0d.lib
    vtkImagingFourier-9.0d.lib
    vtkImagingGeneral-9.0d.lib
    vtkImagingHybrid-9.0d.lib
    vtkImagingMath-9.0d.lib
    vtkImagingMorphological-9.0d.lib
    vtkImagingSources-9.0d.lib
    vtkImagingStatistics-9.0d.lib
    vtkImagingStencil-9.0d.lib
    vtkInfovisCore-9.0d.lib
    vtkInfovisLayout-9.0d.lib
    vtkInteractionImage-9.0d.lib
    vtkInteractionStyle-9.0d.lib
    vtkInteractionWidgets-9.0d.lib
    vtkIOAMR-9.0d.lib
    vtkIOAsynchronous-9.0d.lib
    vtkIOCityGML-9.0d.lib
    vtkIOCore-9.0d.lib
    vtkIOEnSight-9.0d.lib
    vtkIOExodus-9.0d.lib
    vtkIOExport-9.0d.lib
    vtkIOExportGL2PS-9.0d.lib
    vtkIOExportPDF-9.0d.lib
    vtkIOGeometry-9.0d.lib
    vtkIOImage-9.0d.lib
    vtkIOImport-9.0d.lib
    vtkIOInfovis-9.0d.lib
    vtkIOLegacy-9.0d.lib
    vtkIOLSDyna-9.0d.lib
    vtkIOMINC-9.0d.lib
    vtkIOMotionFX-9.0d.lib
    vtkIOMovie-9.0d.lib
    vtkIONetCDF-9.0d.lib
    vtkIOOggTheora-9.0d.lib
    vtkIOParallel-9.0d.lib
    vtkIOParallelXML-9.0d.lib
    vtkIOPLY-9.0d.lib
    vtkIOSegY-9.0d.lib
    vtkIOSQL-9.0d.lib
    vtkIOTecplotTable-9.0d.lib
    vtkIOVeraOut-9.0d.lib
    vtkIOVideo-9.0d.lib
    vtkIOXML-9.0d.lib
    vtkIOXMLParser-9.0d.lib
    vtkjpeg-9.0d.lib
    vtkjsoncpp-9.0d.lib
    vtklibharu-9.0d.lib
    vtklibproj-9.0d.lib
    vtklibxml2-9.0d.lib
    vtkloguru-9.0d.lib
    vtklz4-9.0d.lib
    vtklzma-9.0d.lib
    vtkmetaio-9.0d.lib
    vtknetcdf-9.0d.lib
    vtkogg-9.0d.lib
    vtkParallelCore-9.0d.lib
    vtkParallelDIY-9.0d.lib
    vtkpng-9.0d.lib
    vtkpugixml-9.0d.lib
    vtkRenderingAnnotation-9.0d.lib
    vtkRenderingContext2D-9.0d.lib
    vtkRenderingCore-9.0d.lib
    vtkRenderingFreeType-9.0d.lib
    vtkRenderingGL2PSOpenGL2-9.0d.lib
    vtkRenderingImage-9.0d.lib
    vtkRenderingLabel-9.0d.lib
    vtkRenderingLOD-9.0d.lib
    vtkRenderingOpenGL2-9.0d.lib
    vtkRenderingQt-9.0d.lib
    vtkRenderingSceneGraph-9.0d.lib
    vtkRenderingUI-9.0d.lib
    vtkRenderingVolume-9.0d.lib
    vtkRenderingVolumeOpenGL2-9.0d.lib
    vtkRenderingVtkJS-9.0d.lib
    vtksqlite-9.0d.lib
    vtksys-9.0d.lib
    vtkTestingRendering-9.0d.lib
    vtktheora-9.0d.lib
    vtktiff-9.0d.lib
    vtkverdict-9.0d.lib
    vtkViewsContext2D-9.0d.lib
    vtkViewsCore-9.0d.lib
    vtkViewsInfovis-9.0d.lib
    vtkViewsQt-9.0d.lib
    vtkWrappingTools-9.0d.lib
    vtkzlib-9.0d.lib
    
)

set(VTK_BIN_DIR "F:/VTK/vtk-install/debug/bin")

# 先包含子项目（子项目中会定义 3DPCL 目标）
add_subdirectory("3DPCL")